Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): make retry loop stop immediately when context is cancelled #386

Merged
merged 1 commit into from
Mar 17, 2024

Conversation

benhoyt
Copy link
Contributor

@benhoyt benhoyt commented Mar 14, 2024

I noticed that pebble notices --timeout=60s was taking about 5s to exit after you pressed Ctrl-C, when we were listening to SIGINT correctly and cancelling the context. Turns out defaultRequester.retry was only looking at the timeout channel, not the ctx.Done() one.

Writing this afresh we'd probably just use a context for the timeout as well as for cancellation, but do this minimal fix for now.

I noticed that "pebble notices --timeout=60s" was taking about 5s to
exit after you pressed Ctrl-C, when we were listening to SIGINT
correctly and cancelling the context. Turns out defaultRequester.retry
was only looking at the timeout channel, not the ctx.Done() one.

Writing this afresh we'd probably just use a context for the timeout as
well as for cancellation, but do this minimal fix for now.
Copy link
Contributor

@flotter flotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Nice improvement.

@benhoyt benhoyt merged commit 41ff44b into canonical:master Mar 17, 2024
15 checks passed
@benhoyt benhoyt deleted the client-retry-cancellation branch March 17, 2024 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants